﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace My.Core.Model.Models
{
    /// <summary>
    /// 用户信息表
    /// </summary>
    public class FrameworkUser
    {
        /// <summary>
        /// 主键Id
        /// </summary>
        [DisplayName("主键Id")]
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        /// <summary>
        /// 用户名
        /// </summary>
        [Display(Name = "用户名")]
        [Required]
        [StringLength(100)]
        public string Account { get; set; }


        /// <summary>
        /// 密码
        /// </summary>
        [Display(Name = "密码")]
        [StringLength(100)]
        [Required]
        public string PassWord { get; set; }


        /// <summary>
        ///获取或设置是否禁用，逻辑上的删除，非物理删除
        /// </summary>
        [Display(Name = "是否删除")]
        [DefaultValue(false)]
        public bool? IsDeleted { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        public System.DateTime CreateTime { get; set; } = DateTime.Now;
        /// <summary>
        /// 更新时间
        /// </summary>
        [Display(Name = "更新时间")]
        public System.DateTime UpdateTime { get; set; } = DateTime.Now;

        /// <summary>
        ///最后登录时间 
        /// </summary>
        [Display(Name = "最后登录时间")]
        public DateTime LastLoginTime { get; set; } = DateTime.Now;

        // <summary>
        /// 用户角色
        /// </summary>
        [NotMapped]
        public List<FrameworkUserRole> UserRoles { get; set; }
    }
}
